Skip to content

feat(store): make sqlite pool size configurable#2030

Open
N8N411 wants to merge 1 commit into0xMiden:mainfrom
N8N411:n8n411/issue-1928-sqlite-pool-config
Open

feat(store): make sqlite pool size configurable#2030
N8N411 wants to merge 1 commit into0xMiden:mainfrom
N8N411:n8n411/issue-1928-sqlite-pool-config

Conversation

@N8N411
Copy link
Copy Markdown

@N8N411 N8N411 commented May 1, 2026

Add a new sqlite pool-size option in shared storage CLI options and thread it through store state initialization so operators can tune database concurrency instead of relying on a hardcoded pool of 16.

Summary

  • add a configurable SQLite pool size option via --sqlite.pool_size and MIDEN_NODE_SQLITE_POOL_SIZE
  • thread the pool size through store initialization and DB construction instead of relying on a hardcoded value
  • update affected store DB tests to use the new load signature

Why

Issue #1928 notes that the default fixed pool size can be too low relative to RPC concurrency. This change preserves the current default while allowing operators to tune DB concurrency for their workloads.

Closes #1928

Copy link
Copy Markdown
Collaborator

@Mirko-von-Leipzig Mirko-von-Leipzig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted in the issue, please target main not next

@N8N411 N8N411 changed the base branch from next to main May 2, 2026 14:42
@kkovaacs
Copy link
Copy Markdown
Contributor

kkovaacs commented May 4, 2026

This would just merge next into main, plus all the unrelated changes make this pretty much impossible to review...

Add a new sqlite pool-size option in shared storage CLI options and thread it through store state initialization so operators can tune database concurrency instead of relying on a hardcoded pool of 16.
@N8N411 N8N411 force-pushed the n8n411/issue-1928-sqlite-pool-config branch from c3f9220 to 7d69714 Compare May 5, 2026 09:45
Comment thread crates/db/src/lib.rs
impl Db {
/// Creates a new database instance with the provided connection pool.
pub fn new(database_filepath: &Path) -> Result<Self, DatabaseError> {
Self::new_with_pool_size(database_filepath, NonZeroUsize::new(16).expect("non-zero"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is somewhat unrelated, but I think the deadpool_diesel default of NUM_CPUS * 2 is a better default for the pool size than our hard-wired 16.

@Mirko-von-Leipzig Maybe we should just use that default instead of 16?

Obviously that'd mean some changes here: unless an explicit value is forced on the CLI we should not call builder.max_size(N) at all.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure that makes sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make SQLite connection pool size configurable

3 participants